package com.wteam.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//启动mybatisplus的配置拦截器类
@Configuration
public class mybatisconfig {

@Bean
    public MybatisPlusInterceptor pageInterceptor(){
    MybatisPlusInterceptor interceptor=new MybatisPlusInterceptor();
    //分页拦截器
    interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
    //乐观锁拦截器
    interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());

    return interceptor;


}


}
